package com.iiapk.gridnew;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Handler.Callback;

public class HandlerActivity extends Activity {
	
	protected ProgressDialog mPdLoading;
	
	public static final int DIALOG_BEGIN = 0;
	public static final int DIALOG_END = 1;
	public static final int STATUS_FINISHED = 3;
	
	protected Handler mHandler = new Handler(new Callback() {
		@Override
		public boolean handleMessage(Message msg) {
			switch (msg.what) {
			case DIALOG_BEGIN:
				mPdLoading.show();
				return true;
			case DIALOG_END:
				mPdLoading.dismiss();
				return true;
			}
			return false;
		}
	});
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setupLoadingDialog();
	}
	
	private void setupLoadingDialog() {
		mPdLoading = new ProgressDialog(this);
		mPdLoading.setTitle("提示");
		mPdLoading.setMessage("正在加载,请稍候...");
		mPdLoading.setCancelable(false);
	}

}
